from turtle import title
import numpy as np
import matplotlib.pyplot as plt
from sympy import symbols, integrate,I
import sympy
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = symbols('x')  # 定义符号变量
f = sympy.sin(x) * sympy.exp(I*np.pi)
print(f)


def fn_of_sin(xx, ratio, angle=0):
    if(ratio>0):
        return [np.sin(i)*np.exp(1j*ratio) for i in xx]
    else:
        return [np.sin(i) for i in xx]
    
def fn2(xx):
    return [-np.exp(np.pi*1j)*np.exp(1j*x)/2 - np.exp(np.pi*1j)* np.exp(-1j*x)/2 for x in xx]
    
def plt_in_3d(x, y):
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.plot(x, y_real, y_imag, color='blue')
    ax.set_xlabel('Real Input (x)')
    ax.set_ylabel('Real Part')
    ax.set_zlabel('Imaginary Part')
    plt.show()

n = np.arange(1000)
t = [x*np.pi*2/len(n) for x in n]    
#y1 = [np.sin(x) for x in t]
y = fn2(t)
y_real = np.real(y)  # 实部
y_imag = np.imag(y)  # 虚部
plt_in_3d(t, y)
